<?php
	$dbhost = 'localhost';
	$dbuser = 'soverei3_aapthi';
	$dbpass = 'aapthitech';
	$item_per_page =8;
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db('soverei3_aapthitechblog');
	
    /*$dbhost = 'localhost';
	$dbuser = 'root';
	$dbpass = '';
	$item_per_page =8;
	$conn = mysql_connect($dbhost, $dbuser, $dbpass);
	mysql_select_db('test');*/
	
   $page_number = filter_var($_POST["page"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
   if(!is_numeric($page_number)){
	header('HTTP/1.1 500 Invalid page number!');
	exit();
   }
	$position = ($page_number * $item_per_page);
    $result="";
	$results = 'SELECT * FROM user_reviews ORDER BY sno ASC LIMIT '.$position.', '.$item_per_page.'';
	$retval= mysql_query($results, $conn );
    while($row = mysql_fetch_array($retval))
	{
	?>
		 <div class="span1">
		<div class="img_right">
		<div class="mat_gp_comm">
		<a href='<?echo $row["google_link"];?>' target="_blank"><img class="img_br" alt='<?echo $row["user_name"];?>' src='<?echo $row["image"];?>'></a></div>
	     </div>
		<div class="comm_l">
			<span><?echo $row["user_name"];?>'</span>
			<p>
				<?
					$rating=(int)(str_replace('.0','',$row["rating"]));
					for($i=1;$i<=$rating;$i++){
				?>											
			<img src="img/green-star.png">
				<?}for($j=$i;$j<=5;$j++){?>
			  <img src="img/gray-star.png">
				<?}?>
			</p>
		</div>
		<p><?echo $row["review"];?></p>
      </div>
	<?}
?>

